package com.sysh.web.controller;

import com.sysh.entity.Banners;
import com.sysh.service.BannersService;
import com.sysh.service.FeaturesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * ClassName:  <br/>
 * Function: 主页面的显示<br/>
 * date: 2018年01月15日  <br/>
 *
 * @author 苏积钰
 * @since JDK 1.8
 */

@Controller
@RequestMapping("/index")
public class indexController {
    @Autowired
    private BannersService bannersService;
    @Autowired
    private FeaturesService featuresService;

    @GetMapping("/list")
    @ResponseBody
    public Map<String,Object> indexList()
    {

        System.out.println("来了");
        Map<String,Object> map=new HashMap<>();
        List<Banners> list=bannersService.findAll();
        map.put("banner",list);
        map.put("feature",featuresService.findAll());
        return map;
    }
}
